package com.mentaleye.dal.dao.mybatis;

import com.mentaleye.dal.dao.GroupPersonDao;
import com.mentaleye.dal.model.GroupPerson;
import com.mentaleye.dal.model.GroupPersonExample;
import com.mentaleye.dal.model.GroupPersonKey;
import com.mentaleye.dal.service.GroupPersonMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by Rock on 2017/5/10.
 */

@Repository
public class GroupPersonDaoImpl extends BaseDao implements GroupPersonDao{

    @Autowired
    private GroupPersonMapper groupPersonMapper;

    public boolean add(GroupPerson groupPerson) {
        return getResultByInt(groupPersonMapper.insertSelective(groupPerson));
    }

    public boolean update(GroupPerson groupPerson) {
        return getResultByInt(groupPersonMapper.updateByPrimaryKeySelective(groupPerson));
    }

    public boolean updateByPersonId(GroupPerson groupPerson){
        return getResultByInt(groupPersonMapper.updateByPersonId(groupPerson));
    }

    public boolean delete(GroupPersonKey key) {
        return getResultByInt(groupPersonMapper.deleteByPrimaryKey(key));
    }

    public boolean deleteByExample(GroupPersonExample example) {
        return getResultByInt(groupPersonMapper.deleteByExample(example));
    }

    public boolean deleteGroupPersonList(Map<String,Object> map){
        return getResultByInt(groupPersonMapper.deleteGroupPersonList(map));
    }

    public GroupPerson select(GroupPersonKey key) {
        return groupPersonMapper.selectByPrimaryKey(key);
    }

    public List<GroupPerson> selectByExample(GroupPersonExample example) {
        return groupPersonMapper.selectByExample(example);
    }

    public List<Map<String, Object>> selectByMap(Map<String, Object> map) {
        return groupPersonMapper.selectByMap(map);
    }

    public List<Map<String, Object>> selectByNoClass(Integer classId){
        return groupPersonMapper.selectByNoClass(classId);
    }

    public List<Map<String, Object>> selectPersonByClassId(Integer oaclassId){
        return groupPersonMapper.selectPersonByClassId(oaclassId);
    }

    public List<Map<String, Object>> selectPersonNotGroup(Integer personId){
        return groupPersonMapper.selectPersonNotGroup(personId);
    }
}